<?xml version='1.0' encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <link href="cpip.css" rel="stylesheet" type="text/css" />
    <title>File: /Users/paulross/dev/linux/linux-3.13/arch/x86/include/asm/pgtable_64.h</title>
  </head>
  <body>
    <h1>File: /Users/paulross/dev/linux/linux-3.13/arch/x86/include/asm/pgtable_64.h</h1>
    <p>Green shading in the line number column
means the source is part of the translation unit, red means it is conditionally excluded.
Highlighted line numbers link to the translation unit page. Highlighted macros link to
the macro page.</p>
    <pre><a name="1" /><span class="True">       1:</span> <span class="f">#</span><span class="n">ifndef</span> <a href="cpu.c_macros_noref.html#_X0FTTV9YODZfUEdUQUJMRV82NF9IXzA_"><span class="b">_ASM_X86_PGTABLE_64_H</span></a>
<a name="2" /><span class="True">       2:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_X0FTTV9YODZfUEdUQUJMRV82NF9IXzA_"><span class="b">_ASM_X86_PGTABLE_64_H</span></a>
<a name="3" /><span class="True">       3:</span> 
<a name="4" /><span class="True">       4:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="m">const</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="5" /><span class="True">       5:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="m">asm</span><span class="f">/</span><span class="b">pgtable_64_types</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="6" /><span class="True">       6:</span> 
<a name="7" /><span class="True">       7:</span> <span class="f">#</span><span class="n">ifndef</span> <span class="b">__ASSEMBLY__</span>
<a name="8" /><span class="True">       8:</span> 
<a name="9" /><span class="True">       9:</span> <span class="k">/*</span>
<a name="10" /><span class="True">      10:</span> <span class="k"> * This file contains the functions and defines necessary to modify and use</span>
<a name="11" /><span class="True">      11:</span> <span class="k"> * the x86-64 page table tree.</span>
<a name="12" /><span class="True">      12:</span> <span class="k"> */</span>
<a name="13" /><span class="True">      13:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="m">asm</span><span class="f">/</span><span class="b">processor</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="14" /><span class="True">      14:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">bitops</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="15" /><span class="True">      15:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">threads</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="16" /><span class="True">      16:</span> 
<a name="17" /><span class="True">      17:</span> <span class="m">extern</span> <span class="b">pud_t</span> <span class="b">level3_kernel_pgt</span><span class="f">[</span><span class="c">512</span><span class="f">]</span><span class="f">;</span>
<a name="18" /><span class="True">      18:</span> <span class="m">extern</span> <span class="b">pud_t</span> <span class="b">level3_ident_pgt</span><span class="f">[</span><span class="c">512</span><span class="f">]</span><span class="f">;</span>
<a name="19" /><span class="True">      19:</span> <span class="m">extern</span> <span class="b">pmd_t</span> <span class="b">level2_kernel_pgt</span><span class="f">[</span><span class="c">512</span><span class="f">]</span><span class="f">;</span>
<a name="20" /><span class="True">      20:</span> <span class="m">extern</span> <span class="b">pmd_t</span> <span class="b">level2_fixmap_pgt</span><span class="f">[</span><span class="c">512</span><span class="f">]</span><span class="f">;</span>
<a name="21" /><span class="True">      21:</span> <span class="m">extern</span> <span class="b">pmd_t</span> <span class="b">level2_ident_pgt</span><span class="f">[</span><span class="c">512</span><span class="f">]</span><span class="f">;</span>
<a name="22" /><span class="True">      22:</span> <span class="m">extern</span> <span class="b">pgd_t</span> <span class="b">init_level4_pgt</span><span class="f">[</span><span class="f">]</span><span class="f">;</span>
<a name="23" /><span class="True">      23:</span> 
<a name="24" /><span class="True">      24:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_c3dhcHBlcl9wZ19kaXJfMA__"><span class="b">swapper_pg_dir</span></a> <span class="b">init_level4_pgt</span>
<a name="25" /><span class="True">      25:</span> 
<a name="26" /><span class="True">      26:</span> <span class="m">extern</span> <span class="m">void</span> <span class="b">paging_init</span><span class="f">(</span><span class="m">void</span><span class="f">)</span><span class="f">;</span>
<a name="27" /><span class="True">      27:</span> 
<a name="28" /><span class="True">      28:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHRlX0VSUk9SXzA_"><span class="b">pte_ERROR</span></a><span class="f">(</span><span class="b">e</span><span class="f">)</span>                    \
<a name="29" /><span class="True">      29:</span>     <a href="cpu.c_macros_noref.html#_cHJfZXJyXzA_"><span class="b">pr_err</span></a><span class="f">(</span><span class="e">&quot;%s:%d: bad pte %p(%016lx)\n&quot;</span><span class="f">,</span>        \
<a name="30" /><span class="True">      30:</span>            <span class="b">__FILE__</span><span class="f">,</span> <span class="b">__LINE__</span><span class="f">,</span> <span class="f">&amp;</span><span class="f">(</span><span class="b">e</span><span class="f">)</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_cHRlX3ZhbF8w"><span class="b">pte_val</span></a><span class="f">(</span><span class="b">e</span><span class="f">)</span><span class="f">)</span>
<a name="31" /><span class="True">      31:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cG1kX0VSUk9SXzA_"><span class="b">pmd_ERROR</span></a><span class="f">(</span><span class="b">e</span><span class="f">)</span>                    \
<a name="32" /><span class="True">      32:</span>     <a href="cpu.c_macros_noref.html#_cHJfZXJyXzA_"><span class="b">pr_err</span></a><span class="f">(</span><span class="e">&quot;%s:%d: bad pmd %p(%016lx)\n&quot;</span><span class="f">,</span>        \
<a name="33" /><span class="True">      33:</span>            <span class="b">__FILE__</span><span class="f">,</span> <span class="b">__LINE__</span><span class="f">,</span> <span class="f">&amp;</span><span class="f">(</span><span class="b">e</span><span class="f">)</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_cG1kX3ZhbF8w"><span class="b">pmd_val</span></a><span class="f">(</span><span class="b">e</span><span class="f">)</span><span class="f">)</span>
<a name="34" /><span class="True">      34:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHVkX0VSUk9SXzA_"><span class="b">pud_ERROR</span></a><span class="f">(</span><span class="b">e</span><span class="f">)</span>                    \
<a name="35" /><span class="True">      35:</span>     <a href="cpu.c_macros_noref.html#_cHJfZXJyXzA_"><span class="b">pr_err</span></a><span class="f">(</span><span class="e">&quot;%s:%d: bad pud %p(%016lx)\n&quot;</span><span class="f">,</span>        \
<a name="36" /><span class="True">      36:</span>            <span class="b">__FILE__</span><span class="f">,</span> <span class="b">__LINE__</span><span class="f">,</span> <span class="f">&amp;</span><span class="f">(</span><span class="b">e</span><span class="f">)</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_cHVkX3ZhbF8w"><span class="b">pud_val</span></a><span class="f">(</span><span class="b">e</span><span class="f">)</span><span class="f">)</span>
<a name="37" /><span class="True">      37:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cGdkX0VSUk9SXzA_"><span class="b">pgd_ERROR</span></a><span class="f">(</span><span class="b">e</span><span class="f">)</span>                    \
<a name="38" /><span class="True">      38:</span>     <a href="cpu.c_macros_noref.html#_cHJfZXJyXzA_"><span class="b">pr_err</span></a><span class="f">(</span><span class="e">&quot;%s:%d: bad pgd %p(%016lx)\n&quot;</span><span class="f">,</span>        \
<a name="39" /><span class="True">      39:</span>            <span class="b">__FILE__</span><span class="f">,</span> <span class="b">__LINE__</span><span class="f">,</span> <span class="f">&amp;</span><span class="f">(</span><span class="b">e</span><span class="f">)</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_cGdkX3ZhbF8w"><span class="b">pgd_val</span></a><span class="f">(</span><span class="b">e</span><span class="f">)</span><span class="f">)</span>
<a name="40" /><span class="True">      40:</span> 
<a name="41" /><span class="True">      41:</span> <span class="m">struct</span> <span class="b">mm_struct</span><span class="f">;</span>
<a name="42" /><span class="True">      42:</span> 
<a name="43" /><span class="True">      43:</span> <span class="m">void</span> <span class="b">set_pte_vaddr_pud</span><span class="f">(</span><span class="b">pud_t</span> <span class="f">*</span><a href="cpu.c_macros_noref.html#_cHVkX3BhZ2VfMA__"><span class="b">pud_page</span></a><span class="f">,</span> <span class="m">unsigned</span> <span class="m">long</span> <span class="b">vaddr</span><span class="f">,</span> <span class="b">pte_t</span> <span class="b">new_pte</span><span class="f">)</span><span class="f">;</span>
<a name="44" /><span class="True">      44:</span> 
<a name="45" /><span class="True">      45:</span> 
<a name="46" /><span class="True">      46:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">native_pte_clear</span><span class="f">(</span><span class="m">struct</span> <span class="b">mm_struct</span> <span class="f">*</span><span class="b">mm</span><span class="f">,</span> <span class="m">unsigned</span> <span class="m">long</span> <span class="b">addr</span><span class="f">,</span>
<a name="47" /><span class="True">      47:</span>                     <span class="b">pte_t</span> <span class="f">*</span><span class="b">ptep</span><span class="f">)</span>
<a name="48" /><span class="True">      48:</span> <span class="f">{</span>
<a name="49" /><span class="True">      49:</span>     <span class="f">*</span><span class="b">ptep</span> <span class="f">=</span> <span class="b">native_make_pte</span><span class="f">(</span><span class="c">0</span><span class="f">)</span><span class="f">;</span>
<a name="50" /><span class="True">      50:</span> <span class="f">}</span>
<a name="51" /><span class="True">      51:</span> 
<a name="52" /><span class="True">      52:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">native_set_pte</span><span class="f">(</span><span class="b">pte_t</span> <span class="f">*</span><span class="b">ptep</span><span class="f">,</span> <span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="53" /><span class="True">      53:</span> <span class="f">{</span>
<a name="54" /><span class="True">      54:</span>     <span class="f">*</span><span class="b">ptep</span> <span class="f">=</span> <span class="b">pte</span><span class="f">;</span>
<a name="55" /><span class="True">      55:</span> <span class="f">}</span>
<a name="56" /><span class="True">      56:</span> 
<a name="57" /><span class="True">      57:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">native_set_pte_atomic</span><span class="f">(</span><span class="b">pte_t</span> <span class="f">*</span><span class="b">ptep</span><span class="f">,</span> <span class="b">pte_t</span> <span class="b">pte</span><span class="f">)</span>
<a name="58" /><span class="True">      58:</span> <span class="f">{</span>
<a name="59" /><span class="True">      59:</span>     <span class="b">native_set_pte</span><span class="f">(</span><span class="b">ptep</span><span class="f">,</span> <span class="b">pte</span><span class="f">)</span><span class="f">;</span>
<a name="60" /><span class="True">      60:</span> <span class="f">}</span>
<a name="61" /><span class="True">      61:</span> 
<a name="62" /><span class="True">      62:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">native_set_pmd</span><span class="f">(</span><span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmdp</span><span class="f">,</span> <span class="b">pmd_t</span> <span class="b">pmd</span><span class="f">)</span>
<a name="63" /><span class="True">      63:</span> <span class="f">{</span>
<a name="64" /><span class="True">      64:</span>     <span class="f">*</span><span class="b">pmdp</span> <span class="f">=</span> <span class="b">pmd</span><span class="f">;</span>
<a name="65" /><span class="True">      65:</span> <span class="f">}</span>
<a name="66" /><span class="True">      66:</span> 
<a name="67" /><span class="True">      67:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">native_pmd_clear</span><span class="f">(</span><span class="b">pmd_t</span> <span class="f">*</span><span class="b">pmd</span><span class="f">)</span>
<a name="68" /><span class="True">      68:</span> <span class="f">{</span>
<a name="69" /><span class="True">      69:</span>     <span class="b">native_set_pmd</span><span class="f">(</span><span class="b">pmd</span><span class="f">,</span> <span class="b">native_make_pmd</span><span class="f">(</span><span class="c">0</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="70" /><span class="True">      70:</span> <span class="f">}</span>
<a name="71" /><span class="True">      71:</span> 
<a name="72" /><span class="True">      72:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pte_t</span> <span class="b">native_ptep_get_and_clear</span><span class="f">(</span><span class="b">pte_t</span> <span class="f">*</span><span class="b">xp</span><span class="f">)</span>
<a name="73" /><span class="True">      73:</span> <span class="f">{</span>
<a name="74" /><span class="True">      74:</span> <span class="f">#</span><span class="n">ifdef</span> <a href="cpu.c_macros_ref.html#_Q09ORklHX1NNUF8w"><span class="b">CONFIG_SMP</span></a>
<a name="75" /><span class="True">      75:</span>     <span class="m">return</span> <span class="b">native_make_pte</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_eGNoZ18w"><span class="b">xchg</span></a><span class="f">(</span><span class="f">&amp;</span><span class="b">xp</span><span class="f">-&gt;</span><span class="b">pte</span><span class="f">,</span> <span class="c">0</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="76" /><span class="False">      76:</span> <span class="f">#</span><span class="n">else</span>
<a name="77" /><span class="False">      77:</span>     <span class="k">/* native_local_ptep_get_and_clear,</span>
<a name="78" /><span class="False">      78:</span> <span class="k">       but duplicated because of cyclic dependency */</span>
<a name="79" /><span class="False">      79:</span>     <span class="b">pte_t</span> <span class="b">ret</span> <span class="f">=</span> <span class="f">*</span><span class="b">xp</span><span class="f">;</span>
<a name="80" /><span class="False">      80:</span>     <span class="b">native_pte_clear</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_TlVMTF8w"><span class="b">NULL</span></a><span class="f">,</span> <span class="c">0</span><span class="f">,</span> <span class="b">xp</span><span class="f">)</span><span class="f">;</span>
<a name="81" /><span class="False">      81:</span>     <span class="m">return</span> <span class="b">ret</span><span class="f">;</span>
<a name="82" /><span class="True">      82:</span> <span class="f">#</span><span class="n">endif</span>
<a name="83" /><span class="True">      83:</span> <span class="f">}</span>
<a name="84" /><span class="True">      84:</span> 
<a name="85" /><span class="True">      85:</span> <span class="m">static</span> <span class="m">inline</span> <span class="b">pmd_t</span> <span class="b">native_pmdp_get_and_clear</span><span class="f">(</span><span class="b">pmd_t</span> <span class="f">*</span><span class="b">xp</span><span class="f">)</span>
<a name="86" /><span class="True">      86:</span> <span class="f">{</span>
<a name="87" /><span class="True">      87:</span> <span class="f">#</span><span class="n">ifdef</span> <a href="cpu.c_macros_ref.html#_Q09ORklHX1NNUF8w"><span class="b">CONFIG_SMP</span></a>
<a name="88" /><span class="True">      88:</span>     <span class="m">return</span> <span class="b">native_make_pmd</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_eGNoZ18w"><span class="b">xchg</span></a><span class="f">(</span><span class="f">&amp;</span><span class="b">xp</span><span class="f">-&gt;</span><span class="b">pmd</span><span class="f">,</span> <span class="c">0</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="89" /><span class="False">      89:</span> <span class="f">#</span><span class="n">else</span>
<a name="90" /><span class="False">      90:</span>     <span class="k">/* native_local_pmdp_get_and_clear,</span>
<a name="91" /><span class="False">      91:</span> <span class="k">       but duplicated because of cyclic dependency */</span>
<a name="92" /><span class="False">      92:</span>     <span class="b">pmd_t</span> <span class="b">ret</span> <span class="f">=</span> <span class="f">*</span><span class="b">xp</span><span class="f">;</span>
<a name="93" /><span class="False">      93:</span>     <span class="b">native_pmd_clear</span><span class="f">(</span><span class="b">xp</span><span class="f">)</span><span class="f">;</span>
<a name="94" /><span class="False">      94:</span>     <span class="m">return</span> <span class="b">ret</span><span class="f">;</span>
<a name="95" /><span class="True">      95:</span> <span class="f">#</span><span class="n">endif</span>
<a name="96" /><span class="True">      96:</span> <span class="f">}</span>
<a name="97" /><span class="True">      97:</span> 
<a name="98" /><span class="True">      98:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">native_set_pud</span><span class="f">(</span><span class="b">pud_t</span> <span class="f">*</span><span class="b">pudp</span><span class="f">,</span> <span class="b">pud_t</span> <span class="b">pud</span><span class="f">)</span>
<a name="99" /><span class="True">      99:</span> <span class="f">{</span>
<a name="100" /><span class="True">     100:</span>     <span class="f">*</span><span class="b">pudp</span> <span class="f">=</span> <span class="b">pud</span><span class="f">;</span>
<a name="101" /><span class="True">     101:</span> <span class="f">}</span>
<a name="102" /><span class="True">     102:</span> 
<a name="103" /><span class="True">     103:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">native_pud_clear</span><span class="f">(</span><span class="b">pud_t</span> <span class="f">*</span><span class="b">pud</span><span class="f">)</span>
<a name="104" /><span class="True">     104:</span> <span class="f">{</span>
<a name="105" /><span class="True">     105:</span>     <span class="b">native_set_pud</span><span class="f">(</span><span class="b">pud</span><span class="f">,</span> <span class="b">native_make_pud</span><span class="f">(</span><span class="c">0</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="106" /><span class="True">     106:</span> <span class="f">}</span>
<a name="107" /><span class="True">     107:</span> 
<a name="108" /><span class="True">     108:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">native_set_pgd</span><span class="f">(</span><span class="b">pgd_t</span> <span class="f">*</span><span class="b">pgdp</span><span class="f">,</span> <span class="b">pgd_t</span> <span class="b">pgd</span><span class="f">)</span>
<a name="109" /><span class="True">     109:</span> <span class="f">{</span>
<a name="110" /><span class="True">     110:</span>     <span class="f">*</span><span class="b">pgdp</span> <span class="f">=</span> <span class="b">pgd</span><span class="f">;</span>
<a name="111" /><span class="True">     111:</span> <span class="f">}</span>
<a name="112" /><span class="True">     112:</span> 
<a name="113" /><span class="True">     113:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">native_pgd_clear</span><span class="f">(</span><span class="b">pgd_t</span> <span class="f">*</span><span class="b">pgd</span><span class="f">)</span>
<a name="114" /><span class="True">     114:</span> <span class="f">{</span>
<a name="115" /><span class="True">     115:</span>     <span class="b">native_set_pgd</span><span class="f">(</span><span class="b">pgd</span><span class="f">,</span> <span class="b">native_make_pgd</span><span class="f">(</span><span class="c">0</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="116" /><span class="True">     116:</span> <span class="f">}</span>
<a name="117" /><span class="True">     117:</span> 
<a name="118" /><span class="True">     118:</span> <span class="m">extern</span> <span class="m">void</span> <span class="b">sync_global_pgds</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">long</span> <span class="b">start</span><span class="f">,</span> <span class="m">unsigned</span> <span class="m">long</span> <span class="b">end</span><span class="f">)</span><span class="f">;</span>
<a name="119" /><span class="True">     119:</span> 
<a name="120" /><span class="True">     120:</span> <span class="k">/*</span>
<a name="121" /><span class="True">     121:</span> <span class="k"> * Conversion functions: convert a page and protection to a page entry,</span>
<a name="122" /><span class="True">     122:</span> <span class="k"> * and a page entry and page directory to the page they refer to.</span>
<a name="123" /><span class="True">     123:</span> <span class="k"> */</span>
<a name="124" /><span class="True">     124:</span> 
<a name="125" /><span class="True">     125:</span> <span class="k">/*</span>
<a name="126" /><span class="True">     126:</span> <span class="k"> * Level 4 access.</span>
<a name="127" /><span class="True">     127:</span> <span class="k"> */</span>
<a name="128" /><span class="True">     128:</span> <span class="m">static</span> <span class="m">inline</span> <span class="m">int</span> <span class="b">pgd_large</span><span class="f">(</span><span class="b">pgd_t</span> <span class="b">pgd</span><span class="f">)</span> <span class="f">{</span> <span class="m">return</span> <span class="c">0</span><span class="f">;</span> <span class="f">}</span>
<a name="129" /><span class="True">     129:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_bWtfa2VybmVsX3BnZF8w"><span class="b">mk_kernel_pgd</span></a><span class="f">(</span><span class="b">address</span><span class="f">)</span> <a href="cpu.c_macros_noref.html#_X19wZ2RfMA__"><span class="b">__pgd</span></a><span class="f">(</span><span class="f">(</span><span class="b">address</span><span class="f">)</span> <span class="f">|</span> <a href="cpu.c_macros_ref.html#_X0tFUk5QR19UQUJMRV8w"><span class="b">_KERNPG_TABLE</span></a><span class="f">)</span>
<a name="130" /><span class="True">     130:</span> 
<a name="131" /><span class="True">     131:</span> <span class="k">/* PUD - Level3 access */</span>
<a name="132" /><span class="True">     132:</span> 
<a name="133" /><span class="True">     133:</span> <span class="k">/* PMD  - Level 2 access */</span>
<a name="134" /><span class="True">     134:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHRlX3RvX3Bnb2ZmXzA_"><span class="b">pte_to_pgoff</span></a><span class="f">(</span><span class="b">pte</span><span class="f">)</span> <span class="f">(</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_cHRlX3ZhbF8w"><span class="b">pte_val</span></a><span class="f">(</span><span class="f">(</span><span class="b">pte</span><span class="f">)</span><span class="f">)</span> <span class="f">&amp;</span> <a href="cpu.c_macros_ref.html#_UEhZU0lDQUxfUEFHRV9NQVNLXzA_"><span class="b">PHYSICAL_PAGE_MASK</span></a><span class="f">)</span> <span class="f">&gt;&gt;</span> <a href="cpu.c_macros_ref.html#_UEFHRV9TSElGVF8w"><span class="b">PAGE_SHIFT</span></a><span class="f">)</span>
<a name="135" /><span class="True">     135:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cGdvZmZfdG9fcHRlXzA_"><span class="b">pgoff_to_pte</span></a><span class="f">(</span><span class="b">off</span><span class="f">)</span> <span class="f">(</span><span class="f">(</span><span class="b">pte_t</span><span class="f">)</span> <span class="f">{</span> <span class="f">.</span><span class="b">pte</span> <span class="f">=</span> <span class="f">(</span><span class="f">(</span><span class="b">off</span><span class="f">)</span> <span class="f">&lt;&lt;</span> <a href="cpu.c_macros_ref.html#_UEFHRV9TSElGVF8w"><span class="b">PAGE_SHIFT</span></a><span class="f">)</span> <span class="f">|</span>    \
<a name="136" /><span class="True">     136:</span>                         <a href="cpu.c_macros_ref.html#_X1BBR0VfRklMRV8w"><span class="b">_PAGE_FILE</span></a> <span class="f">}</span><span class="f">)</span>
<a name="137" /><span class="True">     137:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_UFRFX0ZJTEVfTUFYX0JJVFNfMA__"><span class="b">PTE_FILE_MAX_BITS</span></a> <a href="cpu.c_macros_ref.html#_X19QSFlTSUNBTF9NQVNLX1NISUZUXzA_"><span class="b">__PHYSICAL_MASK_SHIFT</span></a>
<a name="138" /><span class="True">     138:</span> 
<a name="139" /><span class="True">     139:</span> <span class="k">/* PTE - Level 1 access. */</span>
<a name="140" /><span class="True">     140:</span> 
<a name="141" /><span class="True">     141:</span> <span class="k">/* x86-64 always has all page tables mapped. */</span>
<a name="142" /><span class="True">     142:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHRlX29mZnNldF9tYXBfMA__"><span class="b">pte_offset_map</span></a><span class="f">(</span><span class="b">dir</span><span class="f">,</span> <span class="b">address</span><span class="f">)</span> <span class="b">pte_offset_kernel</span><span class="f">(</span><span class="f">(</span><span class="b">dir</span><span class="f">)</span><span class="f">,</span> <span class="f">(</span><span class="b">address</span><span class="f">)</span><span class="f">)</span>
<a name="143" /><span class="True">     143:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cHRlX3VubWFwXzA_"><span class="b">pte_unmap</span></a><span class="f">(</span><span class="b">pte</span><span class="f">)</span> <span class="f">(</span><span class="f">(</span><span class="m">void</span><span class="f">)</span><span class="f">(</span><span class="b">pte</span><span class="f">)</span><span class="f">)</span><span class="k">/* NOP */</span>
<a name="144" /><span class="True">     144:</span> 
<a name="145" /><span class="True">     145:</span> <span class="k">/* Encode and de-code a swap entry */</span>
<a name="146" /><span class="True">     146:</span> <span class="f">#</span><span class="n">if</span> <a href="cpu.c_macros_ref.html#_X1BBR0VfQklUX0ZJTEVfMA__"><span class="b">_PAGE_BIT_FILE</span></a> <span class="f">&lt;</span> <a href="cpu.c_macros_ref.html#_X1BBR0VfQklUX1BST1ROT05FXzA_"><span class="b">_PAGE_BIT_PROTNONE</span></a>
<a name="147" /><span class="True">     147:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_U1dQX1RZUEVfQklUU18w"><span class="b">SWP_TYPE_BITS</span></a> <span class="f">(</span><a href="cpu.c_macros_ref.html#_X1BBR0VfQklUX0ZJTEVfMA__"><span class="b">_PAGE_BIT_FILE</span></a> <span class="f">-</span> <a href="cpu.c_macros_ref.html#_X1BBR0VfQklUX1BSRVNFTlRfMA__"><span class="b">_PAGE_BIT_PRESENT</span></a> <span class="f">-</span> <span class="c">1</span><span class="f">)</span>
<a name="148" /><span class="True">     148:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_U1dQX09GRlNFVF9TSElGVF8w"><span class="b">SWP_OFFSET_SHIFT</span></a> <span class="f">(</span><a href="cpu.c_macros_ref.html#_X1BBR0VfQklUX1BST1ROT05FXzA_"><span class="b">_PAGE_BIT_PROTNONE</span></a> <span class="f">+</span> <span class="c">1</span><span class="f">)</span>
<a name="149" /><span class="False">     149:</span> <span class="f">#</span><span class="n">else</span>
<a name="150" /><span class="False">     150:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_U1dQX1RZUEVfQklUU18w"><span class="b">SWP_TYPE_BITS</span></a> <span class="f">(</span><a href="cpu.c_macros_ref.html#_X1BBR0VfQklUX1BST1ROT05FXzA_"><span class="b">_PAGE_BIT_PROTNONE</span></a> <span class="f">-</span> <a href="cpu.c_macros_ref.html#_X1BBR0VfQklUX1BSRVNFTlRfMA__"><span class="b">_PAGE_BIT_PRESENT</span></a> <span class="f">-</span> <span class="c">1</span><span class="f">)</span>
<a name="151" /><span class="False">     151:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_U1dQX09GRlNFVF9TSElGVF8w"><span class="b">SWP_OFFSET_SHIFT</span></a> <span class="f">(</span><a href="cpu.c_macros_ref.html#_X1BBR0VfQklUX0ZJTEVfMA__"><span class="b">_PAGE_BIT_FILE</span></a> <span class="f">+</span> <span class="c">1</span><span class="f">)</span>
<a name="152" /><span class="True">     152:</span> <span class="f">#</span><span class="n">endif</span>
<a name="153" /><span class="True">     153:</span> 
<a name="154" /><span class="True">     154:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_TUFYX1NXQVBGSUxFU19DSEVDS18w"><span class="b">MAX_SWAPFILES_CHECK</span></a><span class="f">(</span><span class="f">)</span> <a href="cpu.c_macros_ref.html#_QlVJTERfQlVHX09OXzA_"><span class="b">BUILD_BUG_ON</span></a><span class="f">(</span><a href="cpu.c_macros_noref.html#_TUFYX1NXQVBGSUxFU19TSElGVF8w"><span class="b">MAX_SWAPFILES_SHIFT</span></a> <span class="f">&gt;</span> <a href="cpu.c_macros_noref.html#_U1dQX1RZUEVfQklUU18w"><span class="b">SWP_TYPE_BITS</span></a><span class="f">)</span>
<a name="155" /><span class="True">     155:</span> 
<a name="156" /><span class="True">     156:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_X19zd3BfdHlwZV8w"><span class="b">__swp_type</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span>            <span class="f">(</span><span class="f">(</span><span class="f">(</span><span class="b">x</span><span class="f">)</span><span class="f">.</span><span class="b">val</span> <span class="f">&gt;&gt;</span> <span class="f">(</span><a href="cpu.c_macros_ref.html#_X1BBR0VfQklUX1BSRVNFTlRfMA__"><span class="b">_PAGE_BIT_PRESENT</span></a> <span class="f">+</span> <span class="c">1</span><span class="f">)</span><span class="f">)</span> \
<a name="157" /><span class="True">     157:</span>                      <span class="f">&amp;</span> <span class="f">(</span><span class="f">(</span><span class="c">1U</span> <span class="f">&lt;&lt;</span> <a href="cpu.c_macros_noref.html#_U1dQX1RZUEVfQklUU18w"><span class="b">SWP_TYPE_BITS</span></a><span class="f">)</span> <span class="f">-</span> <span class="c">1</span><span class="f">)</span><span class="f">)</span>
<a name="158" /><span class="True">     158:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_X19zd3Bfb2Zmc2V0XzA_"><span class="b">__swp_offset</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span>            <span class="f">(</span><span class="f">(</span><span class="b">x</span><span class="f">)</span><span class="f">.</span><span class="b">val</span> <span class="f">&gt;&gt;</span> <a href="cpu.c_macros_noref.html#_U1dQX09GRlNFVF9TSElGVF8w"><span class="b">SWP_OFFSET_SHIFT</span></a><span class="f">)</span>
<a name="159" /><span class="True">     159:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_X19zd3BfZW50cnlfMA__"><span class="b">__swp_entry</span></a><span class="f">(</span><span class="b">type</span><span class="f">,</span> <span class="b">offset</span><span class="f">)</span>    <span class="f">(</span><span class="f">(</span><span class="b">swp_entry_t</span><span class="f">)</span> <span class="f">{</span> \
<a name="160" /><span class="True">     160:</span>                      <span class="f">(</span><span class="f">(</span><span class="b">type</span><span class="f">)</span> <span class="f">&lt;&lt;</span> <span class="f">(</span><a href="cpu.c_macros_ref.html#_X1BBR0VfQklUX1BSRVNFTlRfMA__"><span class="b">_PAGE_BIT_PRESENT</span></a> <span class="f">+</span> <span class="c">1</span><span class="f">)</span><span class="f">)</span> \
<a name="161" /><span class="True">     161:</span>                      <span class="f">|</span> <span class="f">(</span><span class="f">(</span><span class="b">offset</span><span class="f">)</span> <span class="f">&lt;&lt;</span> <a href="cpu.c_macros_noref.html#_U1dQX09GRlNFVF9TSElGVF8w"><span class="b">SWP_OFFSET_SHIFT</span></a><span class="f">)</span> <span class="f">}</span><span class="f">)</span>
<a name="162" /><span class="True">     162:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_X19wdGVfdG9fc3dwX2VudHJ5XzA_"><span class="b">__pte_to_swp_entry</span></a><span class="f">(</span><span class="b">pte</span><span class="f">)</span>        <span class="f">(</span><span class="f">(</span><span class="b">swp_entry_t</span><span class="f">)</span> <span class="f">{</span> <a href="cpu.c_macros_ref.html#_cHRlX3ZhbF8w"><span class="b">pte_val</span></a><span class="f">(</span><span class="f">(</span><span class="b">pte</span><span class="f">)</span><span class="f">)</span> <span class="f">}</span><span class="f">)</span>
<a name="163" /><span class="True">     163:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_X19zd3BfZW50cnlfdG9fcHRlXzA_"><span class="b">__swp_entry_to_pte</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span>        <span class="f">(</span><span class="f">(</span><span class="b">pte_t</span><span class="f">)</span> <span class="f">{</span> <span class="f">.</span><span class="b">pte</span> <span class="f">=</span> <span class="f">(</span><span class="b">x</span><span class="f">)</span><span class="f">.</span><span class="b">val</span> <span class="f">}</span><span class="f">)</span>
<a name="164" /><span class="True">     164:</span> 
<a name="165" /><span class="True">     165:</span> <span class="m">extern</span> <span class="m">int</span> <span class="b">kern_addr_valid</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">long</span> <span class="b">addr</span><span class="f">)</span><span class="f">;</span>
<a name="166" /><span class="True">     166:</span> <span class="m">extern</span> <span class="m">void</span> <span class="b">cleanup_highmap</span><span class="f">(</span><span class="m">void</span><span class="f">)</span><span class="f">;</span>
<a name="167" /><span class="True">     167:</span> 
<a name="168" /><span class="True">     168:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_SEFWRV9BUkNIX1VOTUFQUEVEX0FSRUFfMA__"><span class="b">HAVE_ARCH_UNMAPPED_AREA</span></a>
<a name="169" /><span class="True">     169:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_SEFWRV9BUkNIX1VOTUFQUEVEX0FSRUFfVE9QRE9XTl8w"><span class="b">HAVE_ARCH_UNMAPPED_AREA_TOPDOWN</span></a>
<a name="170" /><span class="True">     170:</span> 
<a name="171" /><span class="True">     171:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_cGd0YWJsZV9jYWNoZV9pbml0XzA_"><span class="b">pgtable_cache_init</span></a><span class="f">(</span><span class="f">)</span>   <span class="m">do</span> <span class="f">{</span> <span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="172" /><span class="True">     172:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_Y2hlY2tfcGd0X2NhY2hlXzA_"><span class="b">check_pgt_cache</span></a><span class="f">(</span><span class="f">)</span>      <span class="m">do</span> <span class="f">{</span> <span class="f">}</span> <span class="m">while</span> <span class="f">(</span><span class="c">0</span><span class="f">)</span>
<a name="173" /><span class="True">     173:</span> 
<a name="174" /><span class="True">     174:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_UEFHRV9BR1BfMA__"><span class="b">PAGE_AGP</span></a>    <a href="cpu.c_macros_noref.html#_UEFHRV9LRVJORUxfTk9DQUNIRV8w"><span class="b">PAGE_KERNEL_NOCACHE</span></a>
<a name="175" /><span class="True">     175:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_noref.html#_SEFWRV9QQUdFX0FHUF8w"><span class="b">HAVE_PAGE_AGP</span></a> <span class="c">1</span>
<a name="176" /><span class="True">     176:</span> 
<a name="177" /><span class="True">     177:</span> <span class="k">/* fs/proc/kcore.c */</span>
<a name="178" /><span class="True">     178:</span> <span class="f">#</span><span class="n">define</span>    <a href="cpu.c_macros_noref.html#_a2NfdmFkZHJfdG9fb2Zmc2V0XzA_"><span class="b">kc_vaddr_to_offset</span></a><span class="f">(</span><span class="b">v</span><span class="f">)</span> <span class="f">(</span><span class="f">(</span><span class="b">v</span><span class="f">)</span> <span class="f">&amp;</span> <a href="cpu.c_macros_noref.html#_X19WSVJUVUFMX01BU0tfMA__"><span class="b">__VIRTUAL_MASK</span></a><span class="f">)</span>
<a name="179" /><span class="True">     179:</span> <span class="f">#</span><span class="n">define</span>    <a href="cpu.c_macros_noref.html#_a2Nfb2Zmc2V0X3RvX3ZhZGRyXzA_"><span class="b">kc_offset_to_vaddr</span></a><span class="f">(</span><span class="b">o</span><span class="f">)</span> <span class="f">(</span><span class="f">(</span><span class="b">o</span><span class="f">)</span> <span class="f">|</span> <span class="f">~</span><a href="cpu.c_macros_noref.html#_X19WSVJUVUFMX01BU0tfMA__"><span class="b">__VIRTUAL_MASK</span></a><span class="f">)</span>
<a name="180" /><span class="True">     180:</span> 
<a name="181" /><span class="True">     181:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_X19IQVZFX0FSQ0hfUFRFX1NBTUVfMA__"><span class="b">__HAVE_ARCH_PTE_SAME</span></a>
<a name="182" /><span class="True">     182:</span> 
<a name="183" /><span class="True">     183:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_dm1lbW1hcF8w"><span class="b">vmemmap</span></a> <span class="f">(</span><span class="f">(</span><span class="m">struct</span> <span class="b">page</span> <span class="f">*</span><span class="f">)</span><a href="cpu.c_macros_ref.html#_Vk1FTU1BUF9TVEFSVF8w"><span class="b">VMEMMAP_START</span></a><span class="f">)</span>
<a name="184" /><span class="True">     184:</span> 
<a name="185" /><span class="True">     185:</span> <span class="m">extern</span> <span class="m">void</span> <span class="b">init_extra_mapping_uc</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">long</span> <span class="b">phys</span><span class="f">,</span> <span class="m">unsigned</span> <span class="m">long</span> <span class="b">size</span><span class="f">)</span><span class="f">;</span>
<a name="186" /><span class="True">     186:</span> <span class="m">extern</span> <span class="m">void</span> <span class="b">init_extra_mapping_wb</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">long</span> <span class="b">phys</span><span class="f">,</span> <span class="m">unsigned</span> <span class="m">long</span> <span class="b">size</span><span class="f">)</span><span class="f">;</span>
<a name="187" /><span class="True">     187:</span> 
<a name="188" /><span class="True">     188:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* !__ASSEMBLY__ */</span>
<a name="189" /><span class="True">     189:</span> 
<a name="190" /><span class="True">     190:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* _ASM_X86_PGTABLE_64_H */</span>
<a name="191" /><span class="True">     191:</span> </pre>
  </body>
</html>
